/* EmloyeeForm.java 
* Created on Dec 20, 2012 
* Author:Mr.Viet
* Phone: 01683430426
* Email: phamvanvietcdhd@gmail.com
*/ 
package com.session2; 

import java.awt.Container;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.icode.utils.AbstractDialog;
import com.icode.utils.DBconnecttion;

public class EmloyeeForm extends AbstractDialog {

	public EmloyeeForm(Container parent) {
		super(parent);
		this.setTitle("Employee Form");
	}
	@Override
	public void createForm() {
		Connection con = DBconnecttion.getConnection();
		try {
			Statement st = con.createStatement();
			ResultSet rs = st.executeQuery("SELECT * FROM Emloyee");
			//Duyet Ket Qua Trong rs
			while(rs.next()){
				int id = rs.getInt("id");
				String name = rs.getString("name");
				String addr = rs.getString("addr");
				String dep = rs.getString("department");
				System.out.println(id+">>"+name+">>"+addr+">>"+dep);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
	}
}
